package com.fordmotor.exception;


public class BasicErrorCodeException  extends Exception {

    private BasicError basicError;

    public BasicErrorCodeException(BasicError errorMessage) {
        this.setErrorMessage(errorMessage);
    }

    public BasicErrorCodeException(){}

    public BasicErrorCodeException(String msg) {
        BasicError errorMessage = BasicError.SUCCESS;
        errorMessage.setMsg(msg);
        this.setErrorMessage(errorMessage);
    }

    public BasicErrorCodeException(Integer code ,String msg) {
        BasicError errorMessage = BasicError.SUCCESS;
        errorMessage.setMsg(msg);
        errorMessage.setCode(code);
        this.setErrorMessage(errorMessage);
    }

    public BasicError getErrorMessage() {
        return basicError;
    }

    public void setErrorMessage(BasicError errorMessage) {
        this.basicError = errorMessage;
    }

    @Override
    public String getMessage() {
        String message = this.basicError.getCode() + ":" + this.basicError.getMsg() + "\n\r";
        return message + super.getMessage();
    }


}
